package com.shanxia.im.api.controller;

import com.shanxia.codec.cmd.*;
import com.shanxia.im.push.DefaultMessagePusher;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("/api")
public class MessageController  {

	@Resource
	private DefaultMessagePusher defaultMessagePusher;

	@PostMapping(value = "/message/3")
	public ResponseEntity<String> send106(String account, Cmd3 cmd3)  {

		defaultMessagePusher.push(account, cmd3);

		return ResponseEntity.ok(account);
	}

	@PostMapping(value = "/message/5")
	public ResponseEntity<String> send5(String account, Cmd5 cmd5)  {

		defaultMessagePusher.push(account, cmd5);

		return ResponseEntity.ok(account);
	}

	@PostMapping(value = "/message/7")
	public ResponseEntity<String> send7(String account, Cmd7 cmd7)  {

		defaultMessagePusher.push(account, cmd7);

		return ResponseEntity.ok(account);
	}

	@PostMapping(value = "/message/111")
	public ResponseEntity<String> send7(String account, Cmd111 cmd111)  {

		defaultMessagePusher.push(account, cmd111);

		return ResponseEntity.ok(account);
	}

	@PostMapping(value = "/message/201")
	public ResponseEntity<String> send201(String account, Cmd201 cmd201)  {

		defaultMessagePusher.push(account, cmd201);

		return ResponseEntity.ok(account);
	}

	@PostMapping(value = "/message/301")
	public ResponseEntity<String> send301(String account, Cmd301 cmd301)  {

		defaultMessagePusher.push(account, cmd301);

		return ResponseEntity.ok(account);
	}

	@PostMapping(value = "/message/303")
	public ResponseEntity<String> send303(String account, Cmd303 cmd303)  {

		defaultMessagePusher.push(account, cmd303);

		return ResponseEntity.ok(account);
	}

	@PostMapping(value = "/message/1103")
	public ResponseEntity<String> send1103(String account, Cmd1103 cmd1103)  {

		defaultMessagePusher.push(account, cmd1103);

		return ResponseEntity.ok(account);
	}
}
